exist, in which case a particular protocol must be specified in this
manner. The protocol number to use is particular to the "communication
domain" in which communication is to take place. If a protocol is
specified by the caller, then it will be packaged into a socket level
option request and sent to the underlying protocol layers.
Sockets of type _SSSS_OOOO_CCCC_KKKK______SSSS_TTTT_RRRR_EEEE_AAAA_MMMM are full-duplex byte streams, similar to
pipes. A stream socket must be in a _c_o_n_n_e_c_t_e_d state before any data may
be sent or received on it. A connection to another socket is created
with a _cccc_oooo_nnnn_nnnn_eeee_cccc_tttt(3N) call. Once connected, data may be transferred using
_rrrr_eeee_aaaa_dddd(2) and _wwww_rrrr_iiii_tttt_eeee(2) calls or some variant of the _ssss_eeee_nnnn_dddd(3N) and _rrrr_eeee_cccc_vvvv(3N)
calls. When a session has been completed, a _cccc_llll_oooo_ssss_eeee(2) may be performed.
Out-of-band data may also be transmitted as described on the _ssss_eeee_nnnn_dddd(3N)
manual page and received as described on the _rrrr_eeee_cccc_vvvv(3N) manual page.
The communications protocols used to implement a _SSSS_OOOO_CCCC_KKKK______SSSS_TTTT_RRRR_EEEE_AAAA_MMMM insure that
data is not lost or duplicated. If a piece of data for which the peer
protocol has buffer space cannot be successfully transmitted within a
reasonable length of time, then the connection is considered broken and
calls will indicate an error with -1 returns and with _EEEE_TTTT_IIII_MMMM_EEEE_DDDD_OOOO_UUUU_TTTT as the
specific code in the global variable _eeee_rrrr_rrrr_nnnn_oooo. The protocols optionally
keep sockets "warm" by forcing transmissions roughly every minute in the
absence of other activity. An error is then indicated if no response can
be elicited on an otherwise idle connection for a extended period (for
instance 5 minutes). A _SSSS_IIII_GGGG_PPPP_IIII_PPPP_EEEE signal is raised if a process sends on a
broken stream; this causes naive processes, which do not handle the
signal, to exit.
_SSSS_OOOO_CCCC_KKKK______SSSS_EEEE_QQQQ_PPPP_AAAA_CCCC_KKKK_EEEE_TTTT sockets employ the same system calls as _SSSS_OOOO_CCCC_KKKK______SSSS_TTTT_RRRR_EEEE_AAAA_MMMM
sockets. The only difference is that _rrrr_eeee_aaaa_dddd calls will return only the
amount of data requested, and any remaining in the arriving packet will
be discarded.
_SSSS_OOOO_CCCC_KKKK______DDDD_GGGG_RRRR_AAAA_MMMM and _SSSS_OOOO_CCCC_KKKK______RRRR_AAAA_WWWW sockets allow datagrams to be sent to
correspondents named in _ssss_eeee_nnnn_dddd_tttt_oooo calls. Datagrams are generally received
with _rrrr_eeee_cccc_vvvv_ffff_rrrr_oooo_mmmm, which returns the next datagram with its return address.
An _ffff_cccc_nnnn_tttt_llll(2) call can be used to specify a process group to receive a
_SSSS_IIII_GGGG_UUUU_RRRR_GGGG signal when the out-of-band data arrives. It may also enable
non-blocking I/O and asynchronous notification of I/O events with _SSSS_IIII_GGGG_IIII_OOOO
signals.
The operation of sockets is controlled by socket level _o_p_t_i_o_n_s. These
options are defined in the file _////_uuuu_ssss_rrrr_////_iiii_nnnn_cccc_llll_uuuu_dddd_eeee_////_ssss_yyyy_ssss_////_ssss_oooo_cccc_kkkk_eeee_tttt_...._hhhh.
_ssss_eeee_tttt_ssss_oooo_cccc_kkkk_oooo_pppp_tttt(3N) and _gggg_eeee_tttt_ssss_oooo_cccc_kkkk_oooo_pppp_tttt(3N) are used to set and get options,
respectively.
RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
A -1 is returned if an error occurs. Otherwise the return value is a